<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>添加用户</title>
<link rel="stylesheet" 
		href="${pageContext.request.contextPath}/themes/icon.css">
<link rel="stylesheet" 
		href="${pageContext.request.contextPath}/themes/bootstrap/easyui.css">
<script type="text/javascript" 
		src="${pageContext.request.contextPath}/js/jquery.js"></script>
<script type="text/javascript" 
		src="${pageContext.request.contextPath}/js/jquery.easyui.min.js"></script>
<script type="text/javascript" 
		src="${pageContext.request.contextPath}/js/easyui-lang-zh_CN.js"></script>
</head>
	<script type="text/javascript">
$(function(){  
	$('#user').window({    
	      border:0,
	      width:400,
	      height:400,
	      title:'添加用户'
	});
	 $('#user').window('close');  
	 $('#submit').linkbutton({    
		    iconCls: 'icon-ok'   
		}); 
		$('#cancel').linkbutton({    
		    iconCls: 'icon-cancel'   
		});
		
	$('#stu1').datagrid({    
	    url:'selectUser',
	    pagination:true,
	    rownumbers:true,
	
	    columns:[[   
	    	{field:'ck',checkbox:true,width:100},
	        {field:'userId',title:'学号',hidden:true,width:100},    
	        {field:'userName',title:'用户名',width:100},    
	        {field:'roleName',title:'角色',width:100},       
	    ]] ,
	    toolbar: [{
			iconCls: 'icon-add',
			text:'添加',
			handler: function(){
				$('#role').combobox({  
					width:160,
					height:20,
				    url:'role',    
				    valueField:'id',    
				    textField:'text'   
				});
				 $('#user').window('open');
				 $('#addUser').form('clear');
				 $('#studentTable').datagrid('reload');
				}
		}]

	    
	}); 
	
	$('#addUser').form({    
        url:'addUser',    
        success:function(data){    
              if(data=='true'){
            	  $('#user').window('close');  
              } else {
            	  $.messager.alert("消息提示","添加失败");
			}
        }    
	}); 
    $('#submit').bind('click', function(){    
    	$('#addUser').submit(); 
    }); 
    $('#cancel').bind('click', function(){    
    	$('#user').window('close');
		$('#addUser').form('clear');
    }); 
   
});
</script>	

<body>
	

	      <table id="stu1"></table> 
<div id="user" >
		<form id="addUser" method="post" style="margin-left: 100px;margin-top: 100px;">   
		    <div>   
		        <label for="name">姓名:</label>   
		       <input class="easyui-textbox"  name="name" style="width:200px,height:40px;">   
		    </div>   
		    <div>   
		        <label for="passwd">密码:</label>   
		        <input class="easyui-textbox" type="password"  name="passwd" style="width:200px,height:40px;">   
		    </div> 
		    <div>
		    	<label for="role">角色:</label>
		    	<input id="role" class="easyui-combobox" name="role"   
     data-options="valueField:'id',textField:'text',url:'role'" />  

		    </div>  
		    
		    <div style="margin-left: 60px;">
			    <a id="submit" href="#"  >提交</a> 
		     	<a id="cancel" href="#"  >取消</a> 
		    </div>
		</form> 
	</div>
	
	

</body>
</html>